#!/bin/python
import os

analyzer = __import__('analyze_results')
print "Previous results"
analyzer.analyze()
print "--"

keywords = ['art.n', 'bar.n', 'begin.v', 'interest', 'plant', 'turn.v', 'use.v', 'vital.a']

heading = 'echo "Results for %s" >> results.txt'

#32-bit version
shell_cmd = 'java -Xmx1000m -cp "bin;lib/stanford-postagger.jar;lib/weka.jar" com.cs224u.Wsd data/%s.train data/%s.test | ./eval.pl data/%s.ans >> results.txt'

#Baseline
#shell_cmd = './baseline.pl data/%s.train data/%s.test | ./eval.pl data/%s.ans >> results.txt'

try:
  os.system('rm results.txt')
except:
  print "results.txt file not found"

for keyword in keywords:
  os.system(heading % (keyword))
  os.system(shell_cmd % (keyword, keyword, keyword))

os.system('grep "right out of" results.txt')

print "--"
print "Current results"
analyzer.analyze()
